<!DOCTYPE html>
<html>
  <head>
    <meta charset="utf-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1" />
    <title>考勤后台</title>
    <link rel="stylesheet" href="/paiban/base.css" />
    <script src="/static/plugs/jquery/jquery.min.js" type="text/javascript"></script>
    <link rel="stylesheet" href="/static/plugs/layer/layer.css">
    <script src="/static/plugs/layer/layer.js"></script>
  </head>
  <body>
      <div class="wrap">
      {include file="menu"}
      <div class="right">
          <form class="form">
              <table class="table">
              <tr>
                  <td>类型名称</td>
                  <td><input type="text" id="banname" placeholder="如：早班，晚班"></td>
              </tr>
              <tr>
                  <td></td>
                  <td><button type="button" class="btn btn-primary" onclick="save()">保存</button></td>
              </tr>
          </table>
          </form>
          <div class="sp"></div>
          <table class="table">
              <tr>
                  <th>类型名称</th>
                  <th></th>
              </tr>
              {foreach($list as $v)}
              <tr>
                  <td>{$v.name}</td>
                  <td class="btn-cmd">
                      <a onclick="remove({$v.id})">删除</a>
                  </td>
              </tr>
              {/foreach}
          </table>
      </div>
      </div>
      <script>
          function save(){
              $.post("/paiban/admin/banleisave",{name:$("#banname").val()},function(res){
                  console.log(res)
                  if(res.code==1)
                  {
                      layer.msg('操作成功',{
                          time:1000,
                          end:function () {
                              location.reload()
                          }
                      })
                  }
              })
          }
          function remove(id){
              $.post("/paiban/admin/banleiremove",{id:id},function(res){
                  console.log(res)
                  if(res.code==1)
                  {
                      layer.msg('操作成功',{
                          time:1000,
                          end:function () {
                              location.reload()
                          }
                      })
                  }
              })
          }
      </script>
  </body>
</html>